package com.example.cafe.work.controller;


import com.example.cafe.work.dto.Result;
import com.example.cafe.work.model.Ticket;
import com.example.cafe.work.service.SeckillTicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 秒杀优惠券表，与优惠券是一对一关系 前端控制器
 * </p>
 *
 * @author hua
 * @since 2024-09-23
 */
@RestController
@RequestMapping("/seckill-ticket")
public class SeckillTicketController {
    @Autowired
    SeckillTicketService seckillTicketService;

    @PostMapping("/addSeckill")
    public void addSeckillVoucher(@RequestBody Ticket ticket) {
        seckillTicketService.addSeckillVoucher(ticket);
    }

    @PostMapping("/seckill/{id}")
    public Result seckillTicket(@PathVariable("id")Integer ticketId){
         return seckillTicketService.seckill(ticketId);

    }


}

